<?php
if(count(get_included_files()) == 1)
	die("Direct access not permitted.");

//Set up a 'catch all' default route and add it to the Router.
$std_route = new Route('/:class/:method/:id');
$std_route->addDynamicElement(':class', ':class')
          ->addDynamicElement(':method', ':method')
          ->addDynamicElement(':id', ':id');
$router->addRoute( 'std', $std_route );

//Set up default route:
$default_route = new Route('/');
$default_route->setMapClass('static')->setMapMethod('index');
$router->addRoute( 'default', $default_route );

//Set up search route
$search = new Route('/search');
$search->setMapClass('static')->setMapMethod('search');
$router->addRoute( 'search', $search );

//Set up language setting route
$language = new Route('/language/:lang');
$language->setMapClass('language')->setMapMethod('set');
$language->addDynamicElement(':lang', ':lang');
$router->addRoute( 'language', $language );

//Set up authentication routes
$login = new Route('/login');
$login->setMapClass('user')->setMapMethod('login');
$router->addRoute( 'login', $login );

$logout = new Route('/logout');
$logout->setMapClass('user')->setMapMethod('logout');
$router->addRoute( 'logout', $logout );

$register = new Route('/register');
$register->setMapClass('user')->setMapMethod('register');
$router->addRoute( 'register', $register );

$admin = new Route('/admin');
$admin->setMapClass('admin')->setMapMethod('index');
$router->addRoute( 'admin', $admin );